package com.example.aitoedu.controller.teacher;

import cn.dev33.satoken.annotation.SaCheckRole;
import cn.dev33.satoken.util.SaResult;
import com.example.aitoedu.dto.CreateSignDTO;
import com.example.aitoedu.service.TeaSignService;
import com.example.aitoedu.vo.TeaSignVO;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/teacher/sign")
@Slf4j
@CrossOrigin
@Tag(name = "教师发布签到相关接口")
@SaCheckRole("教师")
public class TeaSignController {

    @Autowired
    private TeaSignService teaSignService;

    @PostMapping("/publish")
    @Operation(summary = "教师选择班级发布签到")
    public SaResult publish(@RequestBody CreateSignDTO createSignDTO){
        teaSignService.publish(createSignDTO);
        return SaResult.ok();
    }

    @GetMapping("/stuSign")
    @Operation(summary = "教师查询已发布签到的信息")
    public SaResult stuSign(){
        List<TeaSignVO> teaSignVOList = teaSignService.stuSign();
        return SaResult.ok().setData(teaSignVOList);
    }

}
